[T4Scaffolding.Scaffolder(Description = "Scaffolds a message request and response class.")][CmdletBinding()]
param(        
    [parameter(Position = 0, Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$MessageName,
    [parameter(Position = 1, Mandatory = $false)][string]$GroupName,
    [parameter(Position = 2, Mandatory = $false)][hashtable]$RequestProperties,
    [parameter(Position = 3, Mandatory = $false)][hashtable]$ResponseProperties,    
    [string]$ModelName,
    [string]$Project,
	[string]$CodeLanguage,
	[string[]]$TemplateFolders,
	[switch]$Force = $false
)

$outputPath = Join-Path ("Messages"+$GroupName) $MessageName  # The filename extension will be added based on the template's <#@ Output Extension="..." #> directive
$namespace = (Get-Project $Project).Properties.Item("DefaultNamespace").Value

$requestValues  = @()
$RequestProperties.GetEnumerator() | %{ $requestValues+= $_.Key; $requestValues+= $_.Value }

$responseValues = @( )
$ResponseProperties.GetEnumerator() | %{ $responseValues+= $_.Key; $responseValues+= $_.Value }

$model = @{ Namespace = $namespace; MessageName = $MessageName; Group = $GroupName; RequestValues = $requestValues; ResponseValues = $responseValues }

Add-ProjectItemViaTemplate $outputPath -Template MessageTemplate `
	-Model $model `
	-SuccessMessage "Added Message output at {0}" `
	-TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -Force:$Force